package com.easy.common.enumbean;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;

public enum InteractionType {
    //'手机', '邮箱', '会议', '订单', '其他
    PHONE("手机"),EMAIL("邮箱"),MEETING("会议"),ORDER("订单"),OTHER("其他");

    @EnumValue
    private String value;
    private InteractionType(String value) {
        this.value = value;
    }
    @JsonValue
    public String getValue() {
        return this.value;
    }

    @JsonCreator
    public static  InteractionType convert(String val){
        switch (val){
            case "手机":
                return PHONE;
            case "邮箱":
                return EMAIL;
            case "会议":
                return MEETING;
            case "订单":
                return ORDER;
            case "其他":
                return OTHER;
            default:
                throw new RuntimeException("没有对应的枚举类型");
        }
    }

    public String valueOf(){
        return this.value;
    }
    public String toString() {
        return this.value;
    }
}
